home *** CD-ROM | disk | FTP | other *** search
- ; The SenSiv Scrolling Routines
- ────────────────────────────────────────────────────────────────────────────────
- ; Copyright 1994 by SiV productions, All rights reserved.
- ; Copyright 1994 by Tali Streit, All rights reserved.
- ────────────────────────────────────────────────────────────────────────────────
-
- ; Module2
-
-
-
- ; ▄▀▀▀▀▀▀▀▄
- ; █ │ │ █
- ; █ └─┬─┘ █
- ; █ │ █
- ; █ │ █
- ; ▀▄▄▄▄▄▄▄▀
-
- update_scroll2:
- updatescroll2:
- rendy2:
- mov bx, moveY2
- or bx, bx
- js donegY2
-
- and bx, 15 ; do not handle scrolls larger then 16..
- shl bx, 1
- mov ax, rows[bx]
- shr bx, 1
- add SCRorigin2, ax
- jmp doposY2
-
- donegY2: neg bx
- and bx, 15 ; do not handle scrolls larger then 16...
- shl bx, 1
- mov ax, rows[bx]
- sub SCRorigin2, ax
- shr bx, 1
- neg bx
-
- doposY2:
- add Ypos2, bx
- add indexY2, bx ; The 16 counter index thing.
- js goUP2
- cmp indexY2, 16
- jb noYch2
- ;
- ;│ │ ┌── ┌ ┌
- ;└─┬─┘ │ ├──┤ ─┼─
- ; │ └── ┘ ┘
- ;
- mov di, mapX ;┌ update the map pointer.
- add source2, di ;│
-
- mov di, SCRorigin2 ;┌ calculate 128 pixels down from origin
- add di, 128*320 ;│
-
- sub indexY2, 16 ;┌ Subtract the error term...
- mov bx, indexY2 ;│
- shl bx,1 ;│
- sub di, rows[bx] ;│
- sub di, indexX2 ;│
-
- mov si, source2
- mov ax, mapX
-
- add si, ax ;┌ point to the right line in the map
- add si, ax ;│
- add si, ax ;│
- add si, ax ;│
- add si, ax ;│
- add si, ax ;│
- add si, ax ;│
- add si, ax ;│
-
- ; cmp moveX2,0
- ; jns nodoY2
- ; sub di,16
- ; dec si
- ;nodoY2:
- ; DI points to destination place...
- ; SI pointe to source place...
- add si,mapoff
- mov cx,background2
- call do_row
- jmp noYch2
-
- ;
- ;│ │ ┌── ┌ ┌
- ;└─┬─┘ │ ├──┤ ───
- ; │ └── ┘ ┘
- ;
-
- goUP2: ; indexY should be negative...
- mov di,mapX
- sub source2,di
-
- mov di,SCRorigin2
- sub di,16*320
-
- mov bx, indexY2 ;┌ subtract error term.....
- neg bx ;│
- shl bx, 1 ;│
- add di, rows[bx] ;│
- sub di, indexX2 ;│
-
- add indexY2, 16 ;┌ make indexY usable again....
-
- mov si, source2 ;┌ make si point to top line.
- ; sub si, mapX ;│
-
- ; DI points to destination place...
- ; SI pointe to source place...
- add si, mapoff
- mov cx,background2
- call do_row
-
- noYch2:
-
- ; ▄▀▀▀▀▀▀▀▄
- ; █ │ │ █
- ; █ └─┬─┘ █
- ; █ ┌─┴─┐ █
- ; █ │ │ █
- ; ▀▄▄▄▄▄▄▄▀
- ;
- rendX2:
- mov bx, moveX2
- or bx, bx
- js donegX2
-
- and bx, 15 ; do not handle scrolls larger then 16..
- add SCRorigin2, bx
- jmp doposX2
-
- donegX2: neg bx
- and bx, 15 ; do not handle scrolls larger then 16...
- neg bx
- add SCRorigin2, bx
-
- doposX2: add Xpos2, bx
- add indexX2, bx ; The 16 counter index thing.
- js goback2
- cmp indexX2, 16
- jb noXch2
- ;
- ;└┐ ┌┘ ┌── ┌ ┌
- ; ├─┤ │ ├──┤ ─┼─
- ;┌┘ └┐ └── ┘ ┘
- ;
- inc source2 ; Update the source pointer (map)
-
- mov di, SCRorigin2 ;┌ calculate 128 pixels right from origin
- add di, 128 ;│
-
- sub indexX2, 16 ;┌ Subtract the error term...
- sub di, indexX2 ;│
- mov bx, indexY2 ;│
- shl bx,1 ;│
- sub di, rows[bx] ;│
-
- mov si, source2
- add si, 8
-
- ; DI points to destination place...
- ; SI pointe to source place...
- add si,mapoff
- mov cx,background2
- call do_col
- jmp noXch2
-
- ;
- ;│ │ ┌── ┌ ┌
- ;└─┬─┘ │ ├──┤ ───
- ;┌─┴─┐ └── ┘ ┘
- ;│ │
-
- goback2: ; indexX should be negative...
- dec source2
-
- mov di,SCRorigin2
- sub di,16
-
- mov bx, indexX2 ;┌ subtract error term.....
- neg bx ;│
- add di, bx ;│
- mov bx, indexY2 ;│
- shl bx,1 ;│
- sub di, rows[bx] ;│
-
- add indexX2, 16 ;┌ make indexX usable again....
-
- mov si, source2 ;┌ make si point to left col
- ; dec si ;│
-
- ; DI points to destination place...
- ; SI pointe to source place...
- add si, mapoff
- mov cx,background2
- call do_col
-
- noXch2:
- ret
-
- Check2:
- mov bx,Xpos2
- add bx,MoveX2
- cmp bx,maxXpos
- jl _noXwrap2
- neg MoveX2
- _noXwrap2:
- cmp bx,minXpos
- jg noXwarp22
- neg MoveX2
- noXwarp22:
- mov bx,Ypos2
- add bx,MoveY2
- sub bx,16
- cmp bx,maxYpos
- jl _noYwarp2
- neg MoveY2
- _noYwarp2:
- cmp bx,minYpos
- jg noYwarp22
- neg MoveY2
- noYwarp22:
- ret
-
- init_scroll2:
- initscroll2: ; this takes Xpos2 and Ypos2 and calculates the rest.
- ; mov cx,mapx ┌ this is done in initscroll1
- ; sub cx,8 │
- ; shl cx,4 │
- ; mov maxxpos,cx │
- ; │
- ; mov ax,mapy │
- ; sub ax,8 │
- ; shl ax,4 │
- ; mov maxYpos,ax │
-
- mov bx,Ypos2
- shl bx,1
- mov di,rows[bx]
- add di,Xpos2
- mov SCRorigin2,di
- mov bx,Xpos2
- and bx,15
- mov indexX2,bx
- mov bx,Ypos2
- and bx,15
- mov indexY2,bx
-
- mov bx, Ypos2
- shr bx, 4
- mov ax, mapX
- mul bx
- mov source2, ax
- mov bx, Xpos2
- shr bx, 4
- add source2, bx
- ret
-
-